home *** CD-ROM | disk | FTP | other *** search
/ Champak 99 / (Vol 99) Jan 19 2010.iso / Games / aeroplane.swf / scripts / DefineSprite_152 / frame_1 / DoAction.as
Text File  |  2010-01-19  |  3KB  |  138 lines

  1. score = 0;
  2. wznoszenie = false;
  3. sila = 0;
  4. enemySpeed = 10;
  5. shieldCounter = 0;
  6. gramy = true;
  7. this.onMouseDown = function()
  8. {
  9.    if(gramy == true)
  10.    {
  11.       wznoszenie = true;
  12.    }
  13. };
  14. this.onMouseUp = function()
  15. {
  16.    wznoszenie = false;
  17. };
  18. this.onEnterFrame = function()
  19. {
  20.    if(shieldCounter >= 10 && hero.shield._currentframe == 1)
  21.    {
  22.       shield._y = random(200) + 50;
  23.       shield.play();
  24.       shieldCounter = 0;
  25.    }
  26.    if(hero._y >= 350)
  27.    {
  28.       gramy = false;
  29.       krasz.play();
  30.    }
  31.    _parent.score = score;
  32.    if(wznoszenie == true && gramy == true)
  33.    {
  34.       sila += 1;
  35.    }
  36.    else
  37.    {
  38.       sila -= 1;
  39.    }
  40.    hero._y -= sila;
  41.    hero._rotation = (- sila) * 2;
  42.    if(hero._y <= 0)
  43.    {
  44.       wysokosc = - math.round(hero._y / 10);
  45.    }
  46.    else
  47.    {
  48.       wysokosc = "";
  49.    }
  50.    i = 0;
  51.    while(i < 10)
  52.    {
  53.       var dat = eval("kolko" + i);
  54.       dat.onEnterFrame = function()
  55.       {
  56.          var _loc1_ = this;
  57.          _loc1_._x -= 10;
  58.          if(hero._visible == true)
  59.          {
  60.             if(_loc1_._x <= -10)
  61.             {
  62.                _loc1_._x = hero._x - 40;
  63.                _loc1_._y = hero._y;
  64.             }
  65.          }
  66.          if(gramy == false)
  67.          {
  68.             _loc1_.gotoAndStop(2);
  69.          }
  70.       };
  71.       i++;
  72.    }
  73.    i = 0;
  74.    while(i < 10)
  75.    {
  76.       var dat = eval("cloud" + i);
  77.       dat.onEnterFrame = function()
  78.       {
  79.          var _loc1_ = this;
  80.          _loc1_._x -= 15;
  81.          if(_loc1_._x <= -150)
  82.          {
  83.             _loc1_._x = 600;
  84.             _loc1_._y = random(300);
  85.          }
  86.       };
  87.       i++;
  88.    }
  89.    i = 0;
  90.    while(i < 10)
  91.    {
  92.       var dat = eval("coin" + i);
  93.       dat.onEnterFrame = function()
  94.       {
  95.          var _loc1_ = this;
  96.          _loc1_._x -= 10;
  97.          if(_loc1_._x <= -50)
  98.          {
  99.             _loc1_.gotoAndStop(random(6) + 1);
  100.             _loc1_._x = 500;
  101.             _loc1_._y = random(300);
  102.          }
  103.          if(_loc1_.hitTest(hero.tester))
  104.          {
  105.             _loc1_.gotoAndStop("taken");
  106.             score++;
  107.             shieldCounter++;
  108.          }
  109.       };
  110.       i++;
  111.    }
  112.    enemy._x -= enemySpeed;
  113.    enemySpeed += 0.003;
  114.    if(enemy._x <= -20)
  115.    {
  116.       enemy._x = 600;
  117.       enemy._y = random(300);
  118.       enemy.gotoAndStop(1);
  119.    }
  120.    if(enemy.hitTest(hero.tester) && enemy._currentframe == 1)
  121.    {
  122.       gramy = false;
  123.       enemy.play();
  124.       hero.play();
  125.    }
  126.    if(enemy.hitTest(hero.shield.tester) && enemy._currentframe == 1)
  127.    {
  128.       enemy.play();
  129.       hero.shield.gotoAndStop(1);
  130.       score += 10;
  131.    }
  132.    if(shield.hitTest(hero.tester))
  133.    {
  134.       shield.gotoAndStop(1);
  135.       hero.shield.gotoAndStop(2);
  136.    }
  137. };
  138.